package customer.core.ctrl;

import src.User;
import src.util.Message;
import src.util.MessageCfg;
import src.util.ServerIo;

public class ChatControlIo extends ServerIo{
	
	
	public boolean sendMessage(User from, User to, String msg, int roomId)
	{
		new Message( new MessageCfg( true, false));
		message = new Message( "/postMessage", String.class);
//		message.addParam("fromId", String.valueOf(from.getIdUser()));
//		message.addParam("toId",String.valueOf(to.getIdUser()));
		message.addParam("content", msg);
		message.addParam("roomId", String.valueOf(roomId));
		
		sendReceive( );
		System.out.println("MESS = " + message);
		return message.getStatus( ) == 200;
	}
	
	public boolean connect(User toConnect, String gameName)
	{
		new Message( new MessageCfg( true, false));
		message = new Message( "/connect", String.class);
		sendReceive( );
		return message.getStatus( ) == 200;
	}
}
